package com.ask.forMe.service.impl;

import com.google.common.collect.Maps;
import com.google.common.collect.Sets;

import com.ask.forMe.model.entity.User;
import com.ask.forMe.mapper.UserMapper;
import com.ask.forMe.model.entity.UserContext;
import com.ask.forMe.service.UserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {
    /**
     * 生成用户的每日推荐
     *
     * @param userId
     * @return
     */
    @Override
    public List<Long> getDailyRecommendations(Long userId) {

        return List.of();
    }

    /**
     * 根据token获取用户上下文
     *
     * @param token
     * @return
     */
    @Override
    public UserContext loadUserContext(String token) {
        UserContext userContext = new UserContext();
        userContext.setUserId(897004L);
        userContext.setUsername("ask");
        userContext.setRoles(Sets.newHashSet("USER"));
        userContext.setPermissions(Sets.newHashSet("READ:ORDER", "UPDATE:ORDER"));
        userContext.setAttributes(Maps.newHashMap());
        return userContext;
    }
}
